home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _XFRMLIN.C < prev    next >
Text File  |  1992-11-21  |  5KB  |  172 lines

  1. #ifndef NO_MEMORY_H
  2. #include <memory.h>
  3. #endif
  4. #define        CURSES_LIBRARY  1
  5. #include <curses.h>
  6.  
  7. #ifndef        NDEBUG
  8. char *rcsid__xfrmlin = "$Header: c:/curses/private/RCS/_xfrmlin.c%v 2.0 1992/11/15 03:24:38 MH Rel $";
  9. #endif
  10.  
  11.  
  12.  
  13.  
  14. /*man-start*********************************************************************
  15.  
  16.   PDC_transform_line() - transform
  17.  
  18.   PDCurses Description:
  19.        This is a private PDCurses function.
  20.  
  21.        Updates the given physical line to look like the corresponding
  22.        line in _cursvar.tmpwin.
  23.  
  24.   PDCurses Return Value:
  25.        This routine returns TRUE if a premature refresh end
  26.        is allowed, and there is an input character pending.  Otherwise,
  27.        FALSE is returned.
  28.  
  29.   PDCurses Errors:
  30.        No errors are defined for this routine.
  31.  
  32.   Portability:
  33.        PDCurses        bool    PDC_transform_line( int lineno );
  34.  
  35. **man-end**********************************************************************/
  36.  
  37. bool   PDC_transform_line(register int lineno)
  38. {
  39. #if defined (MSC) && defined (DOS)
  40. chtype*        dstp;
  41. chtype*        srcp;
  42. #else
  43. register chtype*       dstp;
  44. register chtype*       srcp;
  45. #endif
  46.        int rc;
  47.        int             x;
  48.        int             endx;
  49.        int             len;
  50.        chtype* ch;
  51.        extern unsigned char atrtab[MAX_ATRTAB];
  52.        chtype temp_line[256]; /* this should be enough for the maximum width of a screen. MH-920715 */
  53.        chtype chr;
  54.        register int j;
  55. #ifdef FLEXOS
  56.        char    line[80];
  57.        char    attr[80];
  58.        FFRAME  sframe;
  59.        RECT    drect;
  60.        RECT    srect;
  61. #endif
  62.  
  63.        if (twin == (WINDOW *)NULL)
  64.                return( FALSE );
  65.  
  66.        x = twin->_firstch[lineno];
  67.        endx = twin->_lastch[lineno];
  68.        dstp = curscr->_y[lineno] + x;
  69.        srcp = twin->_y[lineno] + x;
  70.        len = endx-x+1;
  71.  
  72.        ch = temp_line; /* now have ch pointing to area to contain real attributes. MH-920715 */
  73. #ifdef         DOS
  74. #  if  SMALL || MEDIUM
  75.                movedata(FP_SEG(srcp), FP_OFF(srcp),
  76.                        FP_SEG(ch), FP_OFF(ch),len * sizeof(chtype));
  77. #  else
  78.                memcpy(ch, srcp, len * sizeof(chtype));
  79. #  endif
  80. #else
  81.                memcpy(ch, srcp, len * sizeof(chtype));
  82. #endif
  83.        for (j=0;j<len;j++)          /* for each chtype in the line... */
  84.           {
  85.            chr = temp_line[j] & A_CHARTEXT;
  86.            temp_line[j] = chtype_attr(temp_line[j]) | chr;
  87.           }
  88.  
  89.        if (_cursvar.direct_video)
  90.        {
  91. #ifdef         DOS
  92. #  if  SMALL || MEDIUM
  93.                movedata(FP_SEG(srcp), FP_OFF(srcp),
  94.                        FP_SEG(dstp), FP_OFF(dstp),len * sizeof(chtype));
  95. #  else
  96.                memcpy(dstp, srcp, len * sizeof(chtype));
  97. #  endif
  98. #endif
  99. #ifdef OS2
  100.                memcpy(dstp, srcp, len * sizeof(chtype));
  101. #endif
  102. #ifdef FLEXOS
  103.                _split_plane(curscr, &line[0], &attr[0], lineno, x, lineno, endx);
  104.  
  105.                drect.r_row = lineno;
  106.                drect.r_col = x;
  107.                drect.r_nrow = 1;
  108.                drect.r_ncol = len;
  109.  
  110.                sframe.fr_pl[0] = (UBYTE *) line;
  111.                sframe.fr_pl[1] = (UBYTE *) attr;
  112.                sframe.fr_nrow = 1;
  113.                sframe.fr_ncol = len;
  114.                sframe.fr_use = 0x03;
  115.  
  116.                srect.r_col = 0;
  117.                srect.r_row = 0;
  118.                srect.r_nrow = 1;
  119.                srect.r_ncol = len;
  120.  
  121.                s_copy(0x03, 0x01L, 0L, (far unsigned short *) &drect,
  122.                        (far unsigned short *) &sframe, (far unsigned
  123.                        short *) &srect);
  124.  
  125. #endif
  126. #ifdef DOS
  127. #  if  SMALL || MEDIUM || MSC
  128.                movedata(FP_SEG(ch), FP_OFF(ch),
  129.                        _cursvar.video_seg,
  130.                        _cursvar.video_ofs+(((lineno*curscr->_maxx)+x)*sizeof(chtype)),
  131.                        len * sizeof(chtype));
  132. #  else
  133.                memcpy(MK_FP(_cursvar.video_seg,
  134.                             _cursvar.video_ofs + (((lineno * curscr->_maxx) + x) * sizeof(chtype))),
  135.                       ch, len * sizeof(chtype));
  136. #  endif
  137. #endif
  138. #ifdef OS2
  139.                                        VioWrtCellStr ((PCH)ch, (USHORT)(len*sizeof(chtype)), (USHORT)lineno, (USHORT)x, 0);
  140. #endif
  141.        }
  142.        else
  143.        {
  144.                for (; x <= endx; x++)
  145.                {
  146.                        PDC_gotoxy(lineno, x);
  147.                        PDC_putc( (*ch & A_CHARTEXT),(*ch & A_ATTRIBUTES) >> 8 );
  148.                        ch++;
  149.                }
  150.        }
  151.        twin->_firstch[lineno] = _NO_CHANGE;
  152.        twin->_lastch[lineno] = _NO_CHANGE;
  153.  
  154. /*****************************************************************/
  155. /*****************************************************************/
  156. /*****************************************************************/
  157. /*****************************************************************/
  158. /* temporarily turn off check for typeahead() */
  159. /*
  160.  rc = typeahead(stdin);
  161.  if (_cursvar.refrbrk && rc)
  162.     return(TRUE);
  163.  else
  164.     return(FALSE);
  165. */
  166. /*****************************************************************/
  167. /*****************************************************************/
  168. /*****************************************************************/
  169. /*****************************************************************/
  170.  return(FALSE);
  171. }
  172.